﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SmartSpace.Core;

namespace SsTool
{
    /// <summary>
    /// Interaction logic for CreateUserWindow.xaml
    /// </summary>
    public partial class CreateUserWindow : Window
    {
        private User _user;

        public CreateUserWindow()
        {
            InitializeComponent();

            _user = new User();
            _user.Id = Guid.NewGuid();

            this.DataContext = _user;
        }

        private void _ctlBtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            _user.CreatedTime = DateTime.Now;
            ICoreService service = App.Get<ICoreService>();
            if (service.StoreUser(_user))
            {
                DialogResult = true;
                return;
            }
            MessageBox.Show("保存失败!");
        }
    }
}
